package com.cykj.shop.service.impl;

import java.util.List;

import com.cykj.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cykj.shop.mapper.BsUserMapper;
import com.cykj.system.api.domain.BsUser;
import com.cykj.shop.service.IBsUserService;

/**
 * 商家用户Service业务层处理
 * 
 * @author 天才少年
 * @date 2025-08-21
 */
@Service
public class BsUserServiceImpl implements IBsUserService 
{
    @Autowired
    private BsUserMapper bsUserMapper;

    /**
     * 查询商家用户
     * 
     * @param id 商家用户主键
     * @return 商家用户
     */
    @Override
    public BsUser selectBsUserById(Long id)
    {
        return bsUserMapper.selectBsUserById(id);
    }

    /**
     * 查询商家用户列表
     * 
     * @param bsUser 商家用户
     * @return 商家用户
     */
    @Override
    public List<BsUser> selectBsUserList(BsUser bsUser)
    {
        return bsUserMapper.selectBsUserList(bsUser);
    }

    /**
     * 新增商家用户
     * 
     * @param bsUser 商家用户
     * @return 结果
     */
    @Override
    public int insertBsUser(BsUser bsUser)
    {
        bsUser.setCreateTime(DateUtils.getNowDate());
        return bsUserMapper.insertBsUser(bsUser);
    }

    /**
     * 修改商家用户
     * 
     * @param bsUser 商家用户
     * @return 结果
     */
    @Override
    public int updateBsUser(BsUser bsUser)
    {
        return bsUserMapper.updateBsUser(bsUser);
    }

    /**
     * 批量删除商家用户
     * 
     * @param ids 需要删除的商家用户主键
     * @return 结果
     */
    @Override
    public int deleteBsUserByIds(Long[] ids)
    {
        return bsUserMapper.deleteBsUserByIds(ids);
    }

    /**
     * 删除商家用户信息
     * 
     * @param id 商家用户主键
     * @return 结果
     */
    @Override
    public int deleteBsUserById(Long id)
    {
        return bsUserMapper.deleteBsUserById(id);
    }

    /**
    * @Description:根据电话号码查询用户
    * @Param:[phone]
    * @Return:com.cykj.system.api.domain.BsUser
    */
    @Override
    public BsUser getShopUserInfoByName(String phone) {

        return bsUserMapper.getShopUserInfoByName(phone);
    }
}
